<?php
header("Content-type:text/html; charset=utf-8" );
$conn =mysql_connect('localhost','root','')
or die('数据库无法连接');
mysql_select_db('neu-video',$conn)
or die('数据库不存在');
mysql_set_charset('utf8');
$sql='select * from videotype';
$result=mysql_query($sql,$conn);
/*while ($result &&($row=mysql_fetch_assoc($result))!==FALSE) {
	echo $row['uname'].'<br>';
	# code...
}*/


$videotype = fetch_array($result);
echo '<table border = "1">';
echo '<caption>视频类型</caption>';
echo '<tr><th>序号</th><th>视频类型名</th></tr>';
foreach($videotype as $one )
{
	echo '<tr>';
	echo '<td>'.$one['tid'].'</td>';
	echo '<td>'.$one['typename'].'</td>';
	echo '</tr>';
}
echo '</table>';



echo '</table>';
function fetch_array($results){
	$arrs=array();
	while ($results &&($row=mysql_fetch_assoc($results))!==FALSE) {
	$arrs[]=$row;
}
	return $arrs;

}

?>
